aboutsummaryrefslogtreecommitdiff
path: root/src/app/manga/[title]/[id]/buttons.jsx
diff options
context:
space:
mode:
authorreal-zephex <[email protected]>2024-04-18 21:43:02 +0530
committerreal-zephex <[email protected]>2024-04-18 21:43:02 +0530
commitec888b9bec997456368d03579e569929f3745307 (patch)
tree0932acf009654212c4fe4663858482cd22ab7bd8 /src/app/manga/[title]/[id]/buttons.jsx
parentminor fixes (diff)
downloaddramalama-ec888b9bec997456368d03579e569929f3745307.tar.xz
dramalama-ec888b9bec997456368d03579e569929f3745307.zip
feature added: tracker for mangas
Diffstat (limited to 'src/app/manga/[title]/[id]/buttons.jsx')
-rw-r--r--src/app/manga/[title]/[id]/buttons.jsx31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/app/manga/[title]/[id]/buttons.jsx b/src/app/manga/[title]/[id]/buttons.jsx
index 19da1d3..4c11705 100644
--- a/src/app/manga/[title]/[id]/buttons.jsx
+++ b/src/app/manga/[title]/[id]/buttons.jsx
@@ -2,8 +2,21 @@
import styles from "./info.module.css";
import Link from "next/link";
+import { storeLocal } from "../../history/storeData";
export default function Buttons({ content: data }) {
+ function store_to_local(title, chapter, volume, image, id, id2) {
+ let data = {
+ title: title,
+ chapter: chapter,
+ volume: volume,
+ image: image,
+ id: id,
+ mangaId: id2,
+ };
+ storeLocal(data);
+ }
+
return (
<div className={styles.ChapterContainer}>
{data.chapters &&
@@ -15,9 +28,16 @@ export default function Buttons({ content: data }) {
href={{
pathname: `/manga/info/read/${item.id}`,
}}
- onClick={() =>
- test(item.chapterNumber, item.volumeNumber)
- }
+ onClick={() => {
+ store_to_local(
+ data.title.english || data.title.romaji,
+ parseInt(item.chapterNumber),
+ parseInt(item.volumeNumber),
+ data.image,
+ item.id,
+ data.id
+ );
+ }}
>
<button key={index}>
<div>
@@ -32,8 +52,3 @@ export default function Buttons({ content: data }) {
</div>
);
}
-
-function test(chapter, volume) {
- localStorage.setItem("chapter", chapter);
- localStorage.setItem("volume", volume);
-}